<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body style="width: 100%;height: 100%;display: flex;">
    <fieldset style="width: 520px;height: 800px;background: yellow;margin: 0 auto;font-size: 24px;">

        用户名：&emsp;<input type="text" id="intyonghu"><span id="main1"></span>
        <!-- <p id="p1">请输入用户名</p> -->
        <br>
        姓&emsp;&emsp;名：<input type="text" id="intxingming" style="margin-top: 10px;"><span id="main2"></span>
        <!-- <p id="p2">请输入姓名</p> -->
        <br>
        密&emsp;&emsp;码：<input type="password" id="intmima" style="margin-top: 10px;"><span id="main3"></span>
        <!-- <p id="p3">请输入用密码6~16位</p> -->
        <br>
        联系电话：<input type="text" id="intlianxi" style="margin-top: 10px;"><span id="main4"></span>
        <!-- <p id="p4">请输入用联系电话</p> -->
        <br>
        邮政编码：<input type="text" id="intyouzheng" style="width: 200px; margin-top: 10px;"><span id="main5"></span>
        <!-- <p id="p5">请输入邮政编码/p> -->
            <br>
            <button id="but" style="width: 100px;height: 40px;margin-top: 10px;">注册</button>

    </fieldset>



    <!-- <input type="text" class="ipt">
    <p class="messgae">请输入验证码</p> -->

</body>
<script>
    window.onload = function () {

        // 用户名
        document.getElementById('intyonghu').onblur = function () {
            var reg1 = /\w/
            if(reg1.test(this.value)){
                main1.innerHTML = '√'
            }else{
                main1.innerHTML = '×'
            }
        }

        // 姓名 
        document.getElementById('intxingming').onblur = function () {
            var reg2 = /[\u4e00-\u9fa5]/
            if(reg2.test(this.value)){
                main2.innerHTML = '√'
            }else{
                main2.innerHTML = '×'
            }
        }

        // 密码
        document.getElementById('intmima').onblur = function () {
            var reg3 = /\w/
            if(reg3.test(this.value)){
                main3.innerHTML = '√'
            }else{
                main3.innerHTML = '×'
            }
        }

        // 联系电话
        document.getElementById('intlianxi').onblur = function () {
            var reg4 = /^1[2-9]\d{9}$/
            if(reg4.test(this.value)){
                main4.innerHTML = '√'
            }else{
                main4.innerHTML = '×'
            }
        }

        //邮政编码
        document.getElementById('intyouzheng').onblur = function () {
            var reg5 = /^5\d{5}$/
            if(reg5.test(this.value)){
                main5.innerHTML = '√'
            }else{
                main5.innerHTML = '×'
            }
        }


        // var yh = document.getElementById('intyonghu').onblur = function () {
        //     if (this.value.length < 6 || this.value.length) {
        //         yh.innerHTML = '输入的不正确'
        //     }else{
        //         yh.innerHTML = '输入正确'
        //     }

        // }
        // var xm = document.getElementById('intxingming').onblur;
        // var mm = document.getElementById('intmima').onblur;
        // var lx = document.getElementById('intlianxi').onblur;
        // var yz = document.getElementById('intyouzheng').onblur;

    }


</script>

</html>